package io.renren.controller;

import io.renren.annotation.LoginUser;
import io.renren.common.utils.R;
import io.renren.entity.UserEntity;
import io.renren.service.DemoService;
import io.renren.socket.sendSocket;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.net.Socket;
import java.util.List;

@RestController
@RequestMapping("/view")
public class ViewController {

    @Autowired
    DemoService demoService;

    @GetMapping("getList")
    public R userInfo(){
        List list=demoService.getConnctList();
        return R.ok().put("list",list);
    }
    @GetMapping("send")
    public R send(String ip,String port,String msg){
        String msgReturn= sendSocket.send(ip,Integer.parseInt(port),msg);
        return R.ok().put("msg",msgReturn);
    }

}
